<%--
  Created by IntelliJ IDEA.
  User: 11076
  Date: 2018/11/22
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

    <title>Title</title>
    <%@ include file="../base/top.jsp" %>


    <style>
        #result_admin{
            width: 90%;
            margin: auto;
            margin-top: 20px;
            padding: 20px;
            box-shadow: 0px 0px 3px #888888 ;
            border-radius: 5px;
            background-color: #FFFFFF;
        }
        .modal-dialog{
            z-index: 9999;
        }
    </style>
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <div class="hr hr-18 dotted hr-double"></div>
                <div class="row">
                    <div class="col-xs-12">
                        <%--datatable--%>
                        <div id="result_admin">
                            <table id="data-table" width="80%" style="margin-left: 10%" class="table table-striped table-bordered">
                                <thead>
                                <tr>
                                    <th>
                                        <input type="checkbox" id="check-all"/>
                                    </th>
                                    <th>序号</th>
                                    <th>作业名称</th>
                                    <th>上传时间</th>
                                    <th>类型</th>
                                    <th>大小</th>
                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                            <button class="btn btn-success" id="load-all">批量下载</button>
                        </div>
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>
    </div>
    <!-- /.main-content -->
    <!-- 返回顶部 -->
    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>

</div>
<%@ include file="../base/foot.jsp" %>
<script>
    var table = null;
    var columnsData =  [
        {
            bSortable : false,
            className : "text-left",
            width : "50px",
            'data': 'courseMaterialId',
            render : function(data, type, row, meta) {
                return "<input type=\"checkbox\"/>";
            }
        },
        {
            bSortable : false,
            data: null,
            width : "40px",
            className: 'text-center whiteSpace',
            render:function(data,type,row,meta) {
                return meta.row + 1 +
                    meta.settings._iDisplayStart;
            }
        },
        {'data': 'assignmentName'},
        {'data': 'assignmentCreateTime'},
        {'data': 'fileType',
            bSortable : false
        },
        {'data': 'fileSize',
            bSortable : false,
        }
    ];
    var dataBaseFiled =  [
        {'column2': 'assignment_name'},
        {'column3': 'assignment_create_time'}
    ];
    var url='assignment/getProjectAssignments';
    var paramter = {projectId:"${projectId}"};
    $(document).ready(function() {
        table = $('#data-table').DataTable($.extend(true,{},CONSTANT.DATA_TABLES.DEFAULT_OPTION,{

            columns:columnsData,
            // ajax: {
            //     type: 'post',
            //     url: 'label/getList'
            // }
            ajax: function (data,callback) {
                ajax(data,callback,dataBaseFiled,url,paramter);
            },
            order:[[ 2, "asc" ]]
        }));
    });

    $("#load-all").click(function () {
        var checked = getAllCheckedRowValue();
        for (var index = 0; index < checked.length; index++) {
            //alert(checked[index].assignmentName+checked[index].fileType);
             //alert(checked[index].assignmentAddress);
            download(checked[index].assignmentName+checked[index].fileType, checked[index].assignmentAddress);
        }
    });
</script>

</body>
</html>
